<template>
  <div>
    <h2 style="text-align: center;">增加投资</h2>
    <table class="table table-bordered">
      <tr>
        <td>投资名称</td>
        <td><input type="text" v-model="info.tname">
        </td>
      </tr>
      <tr>
        <td>投资总金额</td>
        <td>
          <input type="text" v-model="info.pricecount">
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <input type="button" value="增加投资" @click="add">
        </td>

      </tr>
    </table>

  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import axios from 'axios';
import {useRouter} from 'vue-router';
let router=useRouter();
const info=ref({
  tname:"",
  pricecount:"",
  de:true,
})
const add=()=>{
  axios({
    url:"http://localhost:8322/api/User/Add",
    method:"post",
    data:info.value
  }).then(res=>{
    if(res.data==1)
    {
      console.log(res.data);
      alert("增加成功");
      router.push("/UsertouziView");
    }
    else
    {
      alert("增加失败");
    }


  })
}

</script>

<style scoped>

</style>